<template>
    <div class="con">
        <h3>当前播放 <span v-if="list.length>=0">({{list.length}})</span></h3>
        <div class="top">
            <span>循环播放</span>
            <p class="tit">
                <span>收藏全部</span>
                |<van-icon @click="deleteAll" class="icon" name="delete-o" />
            </p>
        </div>
        <div class="main">
            <div v-for="(v,i) in list" class="main-item" :key="i" >
                <p @click="changeSong(i)" :class="current==i?'active':''"  class="song van-ellipsis"><van-icon class="s-icon" v-if="current==i" name="volume-o" />{{v.txt}} - <span class="singer van-ellipsis">{{v.name}}</span></p>
                <van-icon @click="delOne(i)" name="cross" />
            </div>
        </div>
    </div>
</template>


<script>
import { mapMutations} from "vuex";

export default {
    props:['list','changeI',"play",'delOne','deleteAll','current','changeSong'],
    data(){
        return {
        }
    },
    mounted(){
    },
    methods:{
        ...mapMutations(['setSxy']),
    },
}
</script>

<style lang="scss" scoped>
.active{
    color:#c20c0c;
}
.con{
    height: 60vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.main{
    width: 100%;
    height: 60vh;
    overflow: auto;
    &-item{
        box-sizing: border-box;
        width: 100%;
        font-size: 14px;
        padding:10px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .song{
        width: 70%;
        text-align: left;
        display: flex;
        align-items: center;
        .s-icon{
            margin-right: 5px;
        }
        .singer{
            margin-left: 5px;
        }
    }
}
h3{
    text-align-last: left;
    font-size: 16px;
    padding-left: 20px;
    padding-top: 10px;
}

.top{
    display: flex;
    justify-content: space-between;
    padding:10px 20px;
    font-size: 14px;
    .tit{
        display: flex;
        width: 30%;
        justify-content: space-between;
        align-items: center;
        .icon{
            font-size: 18px;
        }
    }
}
</style>